using System;
using System.Data;
using System.Collections;

namespace APP.QUANLY.Entity
{
    /// <summary>
    /// Summary description for THONGTINTHE.
    /// </summary>
    public class THONGTINTHEList : CollectionBase
    {
		private string _ErrMsg;
        public string ErrMsg { get { return _ErrMsg; } }
    	public THONGTINTHEList()
    	{
	    }

		public void Add(THONGTINTHE entity)
		{
            this.List.Add(entity);
		}

		public void Add(THONGTINTHEList list)
		{	
			foreach(THONGTINTHE entity in list)
			{
				this.Add(entity);
			}
		}
	
		public new virtual Enumerator GetEnumerator()
		{
		    return new Enumerator(this);
		}
		public virtual THONGTINTHE this[int index]
		{
		    get
			{
				return (THONGTINTHE)this.List[index];
			}
			set
			{
				this.List[index] = value;
			}
		}

		#region Find Object And List Object
		//---PrimaryKey
	public virtual THONGTINTHE Find(string MATHE)
	{
	    foreach (THONGTINTHE obj in this.List)
	    {
		if(obj.MATHE.ToString().ToUpper().Trim() == MATHE.ToString().ToUpper().Trim())
		{
		    obj.IsExisting = true;
		    return obj;
		}
	    }
	    return null;
	}

public virtual THONGTINTHEList FindListByMATHE(string MATHE)
{
	try
	{
		THONGTINTHEList List = new THONGTINTHEList();
		foreach (THONGTINTHE obj in this.List)
		{
		    if(obj.MATHE.ToString().ToUpper().Trim() == MATHE.ToString().ToUpper().Trim())
		    {
				List.Add(obj);
		    }
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
    	{
		_ErrMsg = ex.Message;
        		return null;
    	}
}
		//---NonPrimaryKey
        public virtual THONGTINTHE FindByTEN(string TEN)
        {
	        foreach (THONGTINTHE obj in this.List)
	        {
		        if(obj.TEN.ToString().ToUpper().Trim() == TEN.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual THONGTINTHE FindByTUMUC(decimal TUMUC)
        {
	        foreach (THONGTINTHE obj in this.List)
	        {
		        if(obj.TUMUC.ToString().ToUpper().Trim() == TUMUC.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual THONGTINTHE FindByDENMUC(decimal DENMUC)
        {
	        foreach (THONGTINTHE obj in this.List)
	        {
		        if(obj.DENMUC.ToString().ToUpper().Trim() == DENMUC.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual THONGTINTHE FindByTILEGIAMGIA(decimal TILEGIAMGIA)
        {
	        foreach (THONGTINTHE obj in this.List)
	        {
		        if(obj.TILEGIAMGIA.ToString().ToUpper().Trim() == TILEGIAMGIA.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual THONGTINTHE FindByISUSE(bool ISUSE)
        {
	        foreach (THONGTINTHE obj in this.List)
	        {
		        if(obj.ISUSE.ToString().ToUpper().Trim() == ISUSE.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

        public virtual THONGTINTHE FindByISDELETE(bool ISDELETE)
        {
	        foreach (THONGTINTHE obj in this.List)
	        {
		        if(obj.ISDELETE.ToString().ToUpper().Trim() == ISDELETE.ToString().ToUpper().Trim())
		        {
		            obj.IsExisting = true;
		            return obj;
		        }
	        }
	        return null;
        }

public virtual THONGTINTHEList FindListByTEN(string TEN)
{
	try
	{
		THONGTINTHEList List = new THONGTINTHEList();
		foreach (THONGTINTHE obj in this.List)
		{
			if(obj.TEN.ToString().ToUpper().Trim() == TEN.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual THONGTINTHEList FindListByTUMUC(decimal TUMUC)
{
	try
	{
		THONGTINTHEList List = new THONGTINTHEList();
		foreach (THONGTINTHE obj in this.List)
		{
			if(obj.TUMUC.ToString().ToUpper().Trim() == TUMUC.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual THONGTINTHEList FindListByDENMUC(decimal DENMUC)
{
	try
	{
		THONGTINTHEList List = new THONGTINTHEList();
		foreach (THONGTINTHE obj in this.List)
		{
			if(obj.DENMUC.ToString().ToUpper().Trim() == DENMUC.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual THONGTINTHEList FindListByTILEGIAMGIA(decimal TILEGIAMGIA)
{
	try
	{
		THONGTINTHEList List = new THONGTINTHEList();
		foreach (THONGTINTHE obj in this.List)
		{
			if(obj.TILEGIAMGIA.ToString().ToUpper().Trim() == TILEGIAMGIA.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual THONGTINTHEList FindListByISUSE(bool ISUSE)
{
	try
	{
		THONGTINTHEList List = new THONGTINTHEList();
		foreach (THONGTINTHE obj in this.List)
		{
			if(obj.ISUSE.ToString().ToUpper().Trim() == ISUSE.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}


public virtual THONGTINTHEList FindListByISDELETE(bool ISDELETE)
{
	try
	{
		THONGTINTHEList List = new THONGTINTHEList();
		foreach (THONGTINTHE obj in this.List)
		{
			if(obj.ISDELETE.ToString().ToUpper().Trim() == ISDELETE.ToString().ToUpper().Trim())
			{
				List.Add(obj);
			}
		}
		if (List.Count > 0) return List;
        		else return null;
	}
	catch(Exception ex)
	{
		 _ErrMsg = ex.Message;
       	 	return null;
    	}
}
		#endregion
     
		#region Inner Classes
		/// <summary>
		/// Type-specific enumeration class, used by LogCollection.GetEnumerator.
		/// </summary>
		public class Enumerator : IEnumerator
		{
			private IEnumerator wrapped;

			public Enumerator(THONGTINTHEList collection)
			{
				this.wrapped = ((CollectionBase)collection).GetEnumerator();
			}

			public THONGTINTHE Current
			{
				get
				{
					return (THONGTINTHE)(this.wrapped.Current);
				}
			}

			object IEnumerator.Current
			{
				get
				{
					return (THONGTINTHE)(this.wrapped.Current);
				}
			}

			public bool MoveNext()
			{
				return this.wrapped.MoveNext();
			}

			public void Reset()
			{
				this.wrapped.Reset();
			}
      }
      #endregion  
   }
}